package com.ycl.web.backend;

import com.ycl.model.EbOrder;
import com.ycl.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 订单分页查询
     * @param model
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping("/list")
    public String list(Model model,
                       @RequestParam(value = "page",defaultValue = "1")Integer page,
                       @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize){
        List<EbOrder> ebOrders = orderService.list(page, pageSize);
        model.addAttribute("ebOrders",ebOrders);
        return "manage/order";
    }
}
